package com.army.onlineedict.slice;

import com.army.onlineedict.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Text;

import java.util.List;

public class WearableSearchResultAbilitySlice extends AbilitySlice {
    private Text testSearchResult;

    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_wearable_search_result);

        testSearchResult = (Text) findComponentById(ResourceTable.Id_text_search_result);
        if (null != testSearchResult) {
            testSearchResult.setText("");
            List<String> typeList = intent.getStringArrayListParam("typeList");
            List<String> meaningList = intent.getStringArrayListParam("meaningList");
            for (int i=0; i<typeList.size(); i++) {
                testSearchResult.append(typeList.get(i) + " " + meaningList.get(i) + "\r\n");
            }
            if (typeList.size() == 0) {
                testSearchResult.setText("单词没有查到，请确认单词是否输入错误！");
            }
        }
    }
}
